package com.xxx.idam.sample;



import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.xxx.idam.util.IDAMHibernateDaoSupport;

@Repository
public class UserDaoImpl extends IDAMHibernateDaoSupport implements IUserDao  {
	private static Log log = LogFactory.getLog(UserDaoImpl.class);

	@Override
	public List getUsers()
    {
		return getHibernateTemplate().find("from UserDomain");
    }
	
	@Override
	public UserDomain getUser(Integer id)
    {
      return (UserDomain)getHibernateTemplate().get(UserDomain.class, new Integer(id));
    }
	
	@Override
	public void saveUser(UserDomain userDomain){
		super.getHibernateTemplate().saveOrUpdate(userDomain);
	}
	
	@Override
	public void removeUser(Integer id){
		Object u = super.getHibernateTemplate().get(UserDomain.class, new Integer(id));
		super.getHibernateTemplate().delete(u);
	}

}
